const loader = require.context("./", false, /\.vue$/);

const pages = [];

for (let key of loader.keys()) {
    let page = loader(key).default;
    let name = page.name.startsWith("page-") ? page.name.replace("page-", "") : "";
    let path = page.name.startsWith("page-") ? page.name.replace("page-", "/").split("-").join("/") : "";
    let meta = { title: page.title, nodes: page.nodes, childs: page.childs };
    let component = page;
    if (name && path) pages.push({ name, path, meta, component });
}

export default pages;